package com.jf.springcloud.controller;

import com.jf.springcloud.entity.Member;
import com.jf.springcloud.service.MemberService;
import com.jf.springcloud.util.Msg;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2025-02-14
 * Time:18:28
 */
@RequestMapping("/member")
@RestController
public class MemberController {
    @Resource
    private MemberService memberService;
    @GetMapping("/get/{id}")
    public Msg getById(@PathVariable("id") Integer id) {
        Member member = memberService.getById(id);
        return member != null ? Msg.success().addData("member", member).addData("provider", "12002") : Msg.failed("id not exist").addData("provider", "12002");
    }
    @GetMapping("/get/wait/{id}")
    public Msg getByIdWait(@PathVariable("id") Integer id) {
        Member member = memberService.getById(id);
        return member != null ? Msg.success().addData("member", member).addData("provider", "12002") : Msg.failed("id not exist").addData("provider", "12002");
    }
}
